gl: Make blur nodes with radius ∈ ]0; 1[
authorTimm Bäder <mail@baedert.org>
Tue, 27 Feb 2018 13:22:08 +0000 (14:22 +0100)
committerTimm Bäder <mail@baedert.org>
Tue, 27 Feb 2018 13:22:08 +0000 (14:22 +0100)
Otherwise, the radius here ends up being 0 and we don't draw anything at
all.

gsk/resources/glsl/blur.fs.glsl

index 19be916db1760dfc0056ea8eb7aed3a2f67c4843..abad1c1f3063a9f74fd93e7ad2582d0bd270a974 100644 (file)
@@ -14,7 +14,7 @@ vec4 blur_pixel (in vec2 uv) {
   // XXX The magic value here is GAUSSIAN_SCALE_FACTOR from gskcairoblur.c
   float radius = u_blur_radius  * 2.30348;
 
-  int half_radius = int(radius / 2.0);
+  int half_radius = max(int(radius / 2.0), 1);
 
   for (int y = -half_radius; y < half_radius; y ++) {
     float fy = Gaussian (radius / 2.0, float(y));